package com.slfx.open.api.config;

import com.slfx.open.api.interceptor.ApiRequestInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @author zengqingfa
 * @className InterceptorsConfigurer
 * @description
 * @create 2022/9/25 16:42
 */
@Configuration
public class InterceptorsConfigurer implements WebMvcConfigurer {


    @Resource
    private ApiRequestInterceptor apiRequestInterceptor;

    /**
     * 对外api请求拦截
     *
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(apiRequestInterceptor)
                .addPathPatterns("/opi/**");

    }

}
